<script>
function brands () 
{
	var select_element = null;
	var category_element = null;
	var brand_element = null;

	this.catesys_changed_brand = function (level,value,element)
	{
        var url  = '/goods/category_children_select/system/' + value;
        var data = { };
        this.select_element = element;

        if (level == 4)
        {
        	this.get_brand_select (value);
        }
        else
            this.category_changed_select (url, data);
	
		if(level < 4)	
		{
			document.getElementById("category_sys" + (level + 1)).style.display = 'block';

			
			var k = level + 2;
			for(var i= k; i<= 4; i++)
			{
				var item = document.getElementById("category_sys_" + i);

				var op = new Option('', '0');

				item.options.length = 0;

				item.options[i] = op;
				
				document.getElementById("category_sys" + i).style.display = 'none';
			}	
		}
	}
	
	this.category_changed_select = function (url, data)
	{
		$.post(url, data, function (o) {
				var item = brands_op.select_element;
				item.options.length = 0;
				if (o.status == 0)
				{
					if (o.category.length == 0)
					{
						var op = new Option('', '0');
						item.options[i] = op;
					}else{
						for (var i = 0; i < o.category.length; ++i)
						{
							var v  = o.category[i];
							var op = new Option(v.cate_name, v.id);
							item.options[i] = op;
						}
					}
				}
			}, 'json');
	}
}



</script>


<script type="text/javascript">
var brands_op = new brands();
</script>	
